﻿using System.Collections.Generic;
using EPiServer.Common;
using EPiServer.Common.Categories;
using EPiServer.Community.Club;
using OpenWaves.ActivityFeed.Web;
using System.Linq;

namespace OpenWaves.ActivityFeed.EPiServer.Community
{
    public class ClubMembershipProvider : IUserGroupMembershipProvider
    {
        public IEnumerable<UserGroup> UserGroups
        {
            get
            {
                int totalCount;
                var clubs = ClubHandler.Instance.GetMyClubs(Settings.DefaultSecurity.CurrentUser, ClubHideStatus.Hidden | ClubHideStatus.NotHidden, EntityStatus.Approved, new CategoryCollection(), 0, 100, out totalCount);
                return clubs.Select(club => club.AsUserGroup());
            }
        }
    }
}